eststo clear
foreach data in NPL NLS URB {
	if "`data'"=="NPL" {
		use "${data}/NPL_hh_data.dta", clear
		
		rename FoodIns y
		rename highRemit Mig
		rename highRemitV Vil
		
		drop hhid
		rename hhno hhid
		gen byte wgt_c = 1
		
	}
	else if "`data'"=="NLS" {
		use "${data}/NLS_hh_data.dta", clear
		
		rename hungry y
		rename migr_any Mig
		rename highMigV Vil
	}
	
	else if "`data'"=="URB" {
		use "${data}/URB_indiv_long.dta", clear
		
		rename earn_month y
		rename migr Mig
		rename high_mig Vil
		rename uidno hhid
		
		gen byte wgt_c = 1
		gen byte month = 1	// No time fixed effects
	}
	
	gen byte MV = Mig*Vil
	gen byte postMig = covid*Mig
	gen byte postVil = covid*Vil
	gen byte postMV  = covid*MV
	
	label var Mig "Migrant"
	label var Vil "High Mkt."
	label var MV "Migrant$\times\$High Mkt."
	label var covid "COVID-19"
	label var postMig "COVID-19$\times\$Migrant"
	label var postVil "COVID-19$\times\$High Mkt."
	label var postMV  "COVID-19$\times\$Migrant$\times\$High Mkt."
	
	
	eststo: areg y Mig Vil MV covid postMig postVil postMV [aw=wgt_c], a(month) vce(cluster hhid)
		if ("`data'"!="URB") estadd local fe_m X
	eststo: areg y covid postMig postVil postMV i.month [aw=wgt_c], a(hhid) vce(cluster hhid)
		if ("`data'"!="URB") estadd local fe_m X
		estadd local fe_h X
}

local col1 " Outcome: & \multicolumn{2}{c}{Food Insecurity} & \multicolumn{2}{c}{Food Insecurity} & \multicolumn{2}{c}{Monthly Earnings} \\ "
local col2 " Sample: & \multicolumn{2}{c}{NPL} & \multicolumn{2}{c}{NLS} & \multicolumn{2}{c}{URB} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} "
local col3 "  & (1) & (2) & (3) & (4) & (5) & (6) \\ \midrule"
esttab using "$tables/Table_S12.tex", keep(Mig Vil MV covid postMig postVil postMV) ///
	order(postMig postVil postMV covid Mig Vil MV) ///
	replace se tex label  mlabels(none) nonotes nonumbers nostar b(3) /// starlevels(* 0.1 ** 0.05 *** 0.01)
	stats(fe_m fe_h r2 N, fmt(0 0 2 0) labels("Month FEs" "HH FEs" "R-Squared" "Observations")) ///
	posthead(`col1' `col2' `col3')
